package com.scqkxx.gamebox.activity.home.adapter;

import com.avos.avoscloud.AVObject;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.scqkxx.gamebox.R;
import com.scqkxx.gamebox.activity.activities.utils.ActivityUtil;
import com.scqkxx.gamebox.activity.game.adapter.GameGridAdapter;
import com.scqkxx.gamebox.activity.group.GroupInviteCodeActivity;
import com.scqkxx.gamebox.activity.group.GroupJoinActivity;
import com.scqkxx.gamebox.activity.group.GroupMembersActivity;
import com.scqkxx.gamebox.bean.EvenBusBean;
import com.scqkxx.gamebox.common.Const;

import org.greenrobot.eventbus.EventBus;

import java.util.List;

/**
 * Created by admin on 2018/8/15. 09点37分
 * name: 唐师
 * 用途 ： 游戏页面的适配器
 */

public class NavTeamAdapter extends BaseQuickAdapter<AVObject, BaseViewHolder> {
    private GameGridAdapter mGameGridAllAdapter;

    public NavTeamAdapter(int layoutResId, List<AVObject> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, AVObject item) {
        helper.setText(R.id.tv_nav_item_name, item.getString("name"));

        helper.convertView.setOnClickListener(view -> {
            String name = item.getString("name");
            switch (name) {
                case "我的群组":
                    EventBus.getDefault().post(new EvenBusBean(1));
                    break;
                case "邀请加入":
                    EventBus.getDefault().post(Const.CLOSE_NAV);
                    break;
                case "加入群组":
                    ActivityUtil.switchTo(mContext,GroupJoinActivity.class);
                    EventBus.getDefault().post(Const.CLOSE_NAV);
                    break;
            }
        });

    }
}
